package com.wish.group05.finance.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.wish.group05.base.dto.JrFactoringRequestDto;
import com.wish.group05.base.dto.JrFactoringResponseDto;
import com.wish.group05.base.entity.JrFactoringDetail;
import com.wish.group05.base.service.IJrFactoringDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wish.group05.common.log.annotation.Log;
import com.wish.group05.common.log.enums.BusinessType;
import com.wish.group05.common.security.annotation.PreAuthorize;
import com.wish.group05.common.core.web.controller.BaseController;
import com.wish.group05.common.core.web.domain.AjaxResult;
import com.wish.group05.common.core.utils.poi.ExcelUtil;
import com.wish.group05.common.core.web.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 * 
 * @author wish
 * @date 2022-06-08
 */
@RestController
@RequestMapping("/factoringDetail")
public class TJrFactoringDetailController extends BaseController
{
    @Autowired
    IJrFactoringDetailService jrFactoringDetailService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize(hasPermi = "finance:factoringDetail:list")
    @GetMapping("/list")
    public TableDataInfo list(JrFactoringRequestDto params)
    {
        startPage();
        List<JrFactoringResponseDto> list = jrFactoringDetailService.getJrFactoringDetailList(params);
        return getDataTable(list);
    }




    @PreAuthorize(hasPermi = "finance:factoringDetail:export")
    @Log(title = "导出Excel", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JrFactoringRequestDto params) throws IOException
    {
        startPage();
        List<JrFactoringResponseDto> list = jrFactoringDetailService.getJrFactoringDetailList(params);
        ExcelUtil<JrFactoringResponseDto> util = new ExcelUtil<JrFactoringResponseDto>(JrFactoringResponseDto.class);
        util.exportExcel(response, list, "detail");
    }
//
//    *
//     * 获取【请填写功能名称】详细信息
//
//    @PreAuthorize(hasPermi = "system:detail:query")
//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@PathVariable("id") Long id)
//    {
//        return AjaxResult.success(tJrFactoringDetailService.selectTJrFactoringDetailById(id));
//    }
//
//    *
//     * 新增【请填写功能名称】
//
//    @PreAuthorize(hasPermi = "system:detail:add")
//    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody TJrFactoringDetail tJrFactoringDetail)
//    {
//        return toAjax(tJrFactoringDetailService.insertTJrFactoringDetail(tJrFactoringDetail));
//    }
//
//    *
//     * 修改【请填写功能名称】
//
//    @PreAuthorize(hasPermi = "system:detail:edit")
//    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody TJrFactoringDetail tJrFactoringDetail)
//    {
//        return toAjax(tJrFactoringDetailService.updateTJrFactoringDetail(tJrFactoringDetail));
//    }
//
//    *
//     * 删除【请填写功能名称】
//
//    @PreAuthorize(hasPermi = "system:detail:remove")
//    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ids}")
//    public AjaxResult remove(@PathVariable Long[] ids)
//    {
//        return toAjax(tJrFactoringDetailService.deleteTJrFactoringDetailByIds(ids));
//    }
}
